package system

import (
	"server/middleware"

	"github.com/gin-gonic/gin"
)

type UserRouter struct{}

func (s *UserRouter) InitUserRouter(Router *gin.RouterGroup, PublicGroup *gin.RouterGroup) {
	userRouter := Router.Group("user").Use(middleware.OperationRecord())
	userRouterWithoutRecord := Router.Group("user")
	PublicGroup = PublicGroup.Group("user")
	// PublicGroup加记录 := PublicGroup.Group("user").Use(middleware.OperationRecord())
	{
		PublicGroup.POST("register", baseApi.Register)
		PublicGroup.GET("getUserInfo", baseApi.GetUserInfo)            // 获取自身信息
		PublicGroup.PUT("setSelfInfo", baseApi.SetSelfInfo)            // 设置自身信息
		PublicGroup.POST("changePassword", baseApi.ChangePassword)     // 用户修改密码
		PublicGroup.POST("setUserAuthority", baseApi.SetUserAuthority) // 设置用户权限
	}
	{
		// userRouter.POST("register", baseApi.Register)
		userRouter.POST("admin_register", baseApi.Register) // 管理员注册账号
		// userRouter.POST("changePassword", baseApi.ChangePassword)     // 用户修改密码
		// userRouter.POST("setUserAuthority", baseApi.SetUserAuthority) // 设置用户权限
		userRouter.DELETE("deleteUser", baseApi.DeleteUser) // 删除用户
		userRouter.PUT("setUserInfo", baseApi.SetUserInfo)  // 设置用户信息
		// userRouter.PUT("setSelfInfo", baseApi.SetSelfInfo)                // 设置自身信息
		userRouter.POST("setUserAuthorities", baseApi.SetUserAuthorities) // 设置用户权限组
		userRouter.POST("resetPassword", baseApi.ResetPassword)           // 设置用户权限组
		userRouter.PUT("setSelfSetting", baseApi.SetSelfSetting)          // 用户界面配置
	}
	{
		userRouterWithoutRecord.POST("getUserList", baseApi.GetUserList) // 分页获取用户列表
		// userRouterWithoutRecord.GET("getUserInfo", baseApi.GetUserInfo)  // 获取自身信息
	}
}
